#include <iostream>
//#include <vector>
using namespace std;

int main()
{
    int n, times=0;
    //vector<int> out;
    while(cin >> n && n!=0)
    {
        ++times;
        int time = 0, start = 0;
        for(int i=0; i<n; ++i)
        {
            int to;
            cin >> to;
            int betw = to - start;
            if(betw>0)
            {
                time += 6*betw;
            }
            else if(betw<0)
            {
                time += 4*(-betw);
            }
            else continue;
            start = to;
        }
        time += n*5;
        cout << time << endl;
        //out.push_back(time);
    }
    //for(int i=0; i<times; ++i) cout << out[i] << endl;
    return 0;
}
/*
1 2
3 2 3 1
0

17
41
*/
